/*
 * Copyright (c) 2024 Unionman Technology Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include <boost/multiprecision/cpp_int.hpp>
#include <node_api.h>
class BignumNapi {
public:
    static napi_value constructor(napi_env env, napi_callback_info cb);
    static napi_value powm(napi_env env, napi_callback_info cb);
    static napi_value toBuffer(napi_env env, napi_callback_info cb);
    static napi_value toNumber(napi_env env, napi_callback_info cb);
    static napi_value toString(napi_env env, napi_callback_info cb);
    static napi_value defineClass(napi_env env);

protected:
    static boost::multiprecision::cpp_int cppint_from_byte_array(uint8_t* data, size_t dataLen);
    static void byte_array_from_cppint(boost::multiprecision::cpp_int bigint, uint8_t** data, size_t* dataLen);
    static napi_ref jsClassRef;
};